<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>{$pagetitle}</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="/static/admin/layui/css/layui.css" media="all">
  <link rel="stylesheet" href="/static/admin/style/admin.css" media="all">
</head>
<body>

	<div class="layui-fluid">
	<div class="layui-card">



	<div class="layui-card-body">
	<form class="layui-form" action="{:url()}" method="post" onsubmit="return save_form(this)" lay-filter="component-form-element">
		<input type="hidden" name="role_id" value="{$r.id}">
	<table class="layui-table">
	  <colgroup>
		<col width="150">
		<col width="150">
		<col width="200">
		<col>
	  </colgroup>
	  <thead>
		<tr>
			<th style="width:5%;text-align: center;">catid</th>
			<th style="width:10%">栏目名称</th>
			<th style="text-align: left;width:30%">栏目关系</th>                    
			<th style="width:6%;cursor:pointer;text-decoration: underline; text-align: center;" class="thischeck_all" val="1" objname="info_view">查看权限</th>
			<th style="width:6%;cursor:pointer;text-decoration: underline; text-align: center;" class="thischeck_all" val="1" objname="info_add">增加权限</th>
			<th style="width:6%;cursor:pointer;text-decoration: underline; text-align: center;" class="thischeck_all" val="1" objname="info_editor">编辑权限</th>
			<th style="width:6%;cursor:pointer;text-decoration: underline; text-align: center;" class="thischeck_all" val="1" objname="info_delete">删除权限</th>
			<th style="width:6%;cursor:pointer; text-decoration: underline; text-align: center;" class="thischeck_all" val="1" objname="info_checked">审核权限</th>
		</tr> 
	  </thead>
	  <tbody>
	  {foreach $data as $key=>$v}
            <tr>
                <td style="text-align: center;">{$v.catid}</td>
                <td>{$v.name}</td>
                <td class="tab-title"><a href="{:caturl($v['catid'])}" target="_blank">{:urldecode($v['str'])} {$v.name} </a></td>                                                                 
                <td class="center"><input type="checkbox" name="info_view[]" lay-skin="primary" value="{$v.catid}" {:strstr($r['info_view'],'|'.$v['catid'].'|')?'checked':''}/></td>
                <td class="center"><input type="checkbox" name="info_add[]" lay-skin="primary" value="{$v.catid}" {:strstr($r['info_add'],'|'.$v['catid'].'|')?'checked':''}/></td>
                <td class="center"><input type="checkbox" name="info_editor[]" lay-skin="primary" value="{$v.catid}" {:strstr($r['info_editor'],'|'.$v['catid'].'|')?'checked':''}/></td>
                <td class="center"><input type="checkbox" name="info_delete[]" lay-skin="primary" value="{$v.catid}" {:strstr($r['info_delete'],'|'.$v['catid'].'|')?'checked':''}/></td>
                <td class="center"><input type="checkbox" name="info_checked[]" lay-skin="primary" value="{$v.catid}" {:strstr($r['info_checked'],'|'.$v['catid'].'|')?'checked':''}/></td>                       
            </tr>
	   {/foreach}
	  </tbody>
	</table>
		<div class="layui-form-item layui-layout-admin" style="margin-top: 30px;">
			<div class="layui-input-block">
			   <div class="layui-footer" style="left: 0;">
				  <button class="layui-btn" lay-submit="" type="submit" lay-filter="component-form-element">立即提交</button>
				  <button type="reset" class="layui-btn layui-btn-primary cancel">返回</button>
			  </div>
			</div>
		</div> 
	</form>				  
	</div>
      
	</div>
</div>

  <script src="/static/admin/layui/layui.js"></script>
  <script src="/static/js/jquery.min.js"></script>    
  <script src="/static/js/globals.js"></script>  
  <script>
  layui.config({
    base: '/static/admin/' //静态资源所在路径
  }).extend({
    index: 'lib/index' //主入口模块
  }).use(['index', 'form'], function(){
    var $ = layui.$
    ,admin = layui.admin
    ,element = layui.element
    ,form = layui.form;
    
    form.render(null, 'component-form-element');
    element.render('breadcrumb', 'breadcrumb');
	//全选
    $(".thischeck_all").click(function(){
        var y=$(this).attr("val");
        var objname=$(this).attr("objname");
        if(y==0){
            $("input[name='"+objname+"[]']").prop("checked", false);
            y=1;
        }else if(y==1){
            $("input[name='"+objname+"[]']").prop("checked", true);
            y=0;
        }
        $(this).attr("val",y);
		form.render(null, 'component-form-element');
    })
		layer.tips('点我可以[全选][反选]', '.thischeck_all', {
		  tips: [1, '#000'] //还可配置颜色
		});
  });
  </script>

</body>
</html>
